< previous page page_274 next page >

Page 274
e10a6a0a59f035e870d90cca05b85fce.gif
            window_style = (window_style Or WS_CHILD)

            ' Set the window's new style.
            SetWindowLong frmCover.hwnd,  _
                GWL_STYLE, window_style

            ' Get the preview area hWnd.
            preview_hwnd = GetHwndFromCommand(args)

            ' Set the window's parent so it appears
            ' inside the preview area.
            SetParent frmCover.hwnd, preview_hwnd

            ' Save the preview area's hWnd in
            ' the form's window structure.
            SetWindowLong frmCover.hwnd, _
                GWL_HWNDPARENT, preview_hwnd

            ' Get the dimensions of the preview area.
            GetClientRect preview_hwnd, preview_rect

            ' Show the preview.
            SetWindowPos frmCover.hwnd, _
                HWND_TOP, 0&, 0&, _
                preview_rect.Right, _
                preview_rect.Bottom, _
                SWP_NOZORDER Or SWP_NOACTIVATE Or _
                    SWP_SHOWWINDOW
    End Select
End Sub
Screen savers must handle a few other details that are much less confusing. To protect the screen as completely as possible, make the program run maximized with no title bar. Set the form's background color to black to reduce the chances of burning the screen phosphors. You can complete these steps by setting the main form's property values as shown in Table 9.1.
Table 9.1 Main Form Property Values for Screen Savers
e10a6a0a59f035e870d90cca05b85fce.gif
PROPERTY
VALUE
e10a6a0a59f035e870d90cca05b85fce.gif
BackColor
&H00000000
e10a6a0a59f035e870d90cca05b85fce.gif
Caption
" "
e10a6a0a59f035e870d90cca05b85fce.gif
ControlBox
False
e10a6a0a59f035e870d90cca05b85fce.gif
MaxButton
False
e10a6a0a59f035e870d90cca05b85fce.gif
MinButton
False
e10a6a0a59f035e870d90cca05b85fce.gif
WindowState
2 - maximized

 
< previous page page_274 next page >